<script type="text/javascript" src="application/modules/Fmusic/externals/scripts/lightface/LightFace.js"></script>
<script type="text/javascript" src="application/modules/Fmusic/externals/scripts/lightface/LightFace.Image.js"></script>

<script type="text/javascript" src="application/modules/Fmusic/externals/scripts/core.js"></script>
<?php if($this->isLoad):?>
<script type="text/javascript" src="application/modules/Fmusic/externals/scripts/ThinkleScroller.js"></script>
<?php endif;?>
<script type="text/javascript">
var locationUrl = window.location.href;
var isRequestActive = 0;
var text_close = '<?php echo $this->translate('Press Esc to close')?>';
var oldSmoothboxBindFmusic = Smoothbox.bind;
Smoothbox.bind = function(el) {
	$$('div.playlist_short_player').set('class', 'music_player playlist_short_player_fmusic');
	$$('div.playlist_short_player_fmusic').removeEvent('click').addEvent('click', function(e){
		e.stop();
		$(this).setStyle('opacity', 0.4);
		lightV = new LightFaceMusic({
			title: '',
			fadeDuration: 100,
	//					fadeDelay: 500,
			keys: {
				esc: function() {
					this.close();
				}
			}
		});	
		
		var playlist = $(this).getParent().getElement('ul.music_player_tracks');
		var classes = playlist.get('class');
		var id = classes.substring(29);
		var url = en4.core.baseUrl + 'music/'+id+'/';
		
		load = lightV.load(url, '0');
		var lb = lightV;
		window.addEvent('keypress', function(e){
			if(e.key == 'esc'){
				if(lb)
					lb.close();
				
			}
		});			
		$(this).setStyle('opacity', 1);
		
		return false;
	});
	
	oldSmoothboxBindFmusic(el);
}
en4.core.runonce.add(function() {
	$$('ul.music_browse div.music_browse_info_title > h3 > a').removeEvent('click').addEvent('click', function(e){
		lightV = new LightFaceMusic({
			title: '',
			fadeDuration: 100,
	//					fadeDelay: 500,
			keys: {
				esc: function() {
					this.close();
				}
			}
		});	
		//var idSeft = $(this).get('id');
		//var id = idSeft.substring(20);
		//var url = en4.core.baseUrl + 'music/'+id+'/';

		lightV.load($(this).get('href'), '0');
		return false;
	});
	$$('ul.music_browse div.music_player').removeEvent('click').addEvent('click', function(e){
		lightV = new LightFaceMusic({
			title: '',
			fadeDuration: 100,
	//					fadeDelay: 500,
			keys: {
				esc: function() {
					this.close();
				}
			}
		});
		var idLiParent = $(this).getParent().getParent().getParent().get('id');
		var id = idLiParent.substring(20);
		var url = en4.core.baseUrl + 'music/'+id+'/';
		
		lightV.load(url, '0');
		return false;
	});
});
function boxNextMusicFmusic(url){
		load = lightV.load(url, '1');
}	
</script>
